package com.client.mikocompose.ui

import com.client.mikocompose.ui.modules.home.*

/**
 * @Description:
 * @Author: 吴祖清
 * @CreateDate: 12.2.22 5:52 下午
 */
object DataGen {
    val url =
        "https://img1.baidu.com/it/u=1295332999,883351360&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=889"

    private fun genGame(gameId: Int, gameName: String, gameIcon: String): GameInfo {
        val gameInfo = GameInfo()
        gameInfo.gameId = gameId
        gameInfo.gameName = gameName
        gameInfo.gameIcon = gameIcon
        return gameInfo
    }

    fun genData(gameInfo: GameInfo): OneGameModel {
        val data = OneGameModel()
        data.playNum = 50
        data.gameInfo = gameInfo
        return data
    }

    fun fk(): GameInfo {
        return genGame(1, "方块大逃亡", url)
    }

    fun fxq(): GameInfo {
        return genGame(2, "飞行棋", url)
    }

    fun nhwc(): GameInfo {
        return genGame(3, "你画我猜", url)
    }

    fun wzq(): GameInfo {
        return genGame(4, "五子棋", url)
    }

    fun bwfw(): GameInfo {
        return genGame(5, "百万富翁", url)
    }


    private fun genBanner(id: Int, imageUrl: String): BannerModel {
        val model = BannerModel()
        model.id = id
        model.imageUrl = imageUrl
        return model
    }

    fun genBanner(): MutableList<BannerModel> {
        return mutableListOf<BannerModel>().apply {
            add(genBanner(1, url))
            add(genBanner(2, url))
            add(genBanner(3, url))
            add(genBanner(4, url))
        }
    }

    private fun genRankItem(gameInfo: GameInfo, userInfo: UserInfo): RankItemModel {
        val model = RankItemModel()
        model.gameInfo = gameInfo
        model.winUser = userInfo
        return model
    }

    private fun genUser(id: Int, name: String, icon: String, gender: Int): UserInfo {
        val model = UserInfo()
        model.userId = "$id"
        model.nickname = name
        model.icon = icon
        model.gender = gender
        return model
    }

    fun genTitle(): TitleModel {
        val model = TitleModel()
        model.title = "排行榜"
        return model
    }

    fun genRank(): MutableList<RankItemModel> {
        val list = mutableListOf<RankItemModel>()
        list.add(genRankItem(fk(), userInfo = genUser(1, "张三", url, 1)))
        list.add(genRankItem(wzq(), userInfo = genUser(1, "张三", url, 1)))
        list.add(genRankItem(fxq(), userInfo = genUser(1, "张三", url, 1)))
        list.add(genRankItem(nhwc(), userInfo = genUser(1, "张三", url, 1)))
        list.add(genRankItem(bwfw(), userInfo = genUser(1, "张三", url, 1)))
        return list
    }

    fun genTwoGame(list: MutableList<OneGameModel>): TwoGameModel {
        val model = TwoGameModel()
        model.list = list
        return model
    }
}